package com.guigu.www.controller.yinBo;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.guigu.www.dao.bean.TMember;
import com.guigu.www.dao.bean.TMemberExamination;
import com.guigu.www.dao.bean.TSetmeal;
import com.guigu.www.service.TMemberExaminationService;
import com.guigu.www.service.TSetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 会员检查表 前端控制器
 * </p>
 *
 * @author abo
 * @since 2021-06-26
 */
@RestController
@CrossOrigin
@RequestMapping("/tMemberExamination")
public class TMemberExaminationController {

    @Autowired
    TMemberExaminationService tMemberExaminationService;
    @Autowired
    TSetmealService tSetmealService;

    @GetMapping("/{id}")
    public List<TMemberExamination> x(@PathVariable("id") int id){
        Wrapper<TMemberExamination> wrapper = new EntityWrapper<TMemberExamination>();
        wrapper.eq("t_member_id",id);

        List<TMemberExamination> tMemberExaminations = tMemberExaminationService.selectList(wrapper);
        return tMemberExaminations;
        /*ArrayList<Integer> tSetmeals = new ArrayList<Integer>();
        for (TMemberExamination x:tMemberExaminations) {
            System.out.println(x.getTSetmealId());
            tSetmeals.add(x.getTSetmealId());
        }

        ArrayList<String> taocanmingzi = new ArrayList<String>();
        for (Integer c:tSetmeals) {
            EntityWrapper<TSetmeal> wrapper1 = new EntityWrapper<TSetmeal>();
            wrapper.eq("id",c);
            TSetmeal tSetmeal = tSetmealService.selectOne(wrapper1);
            taocanmingzi.add(tSetmeal.getName());
            System.out.println("套餐名字"+tSetmeal.getName());
        }*/
    }
}

